﻿namespace CGF
{

    //网路消息 - 通用接口
    public interface INetMessage
    {
        void OnMessageHandler(object msg);
    }

    //网路消息 - 通用父类
    public abstract class NetMessage<T> : INetMessage where T : class
    {
        public abstract void OnMessage(T msg);

        public void OnMessageHandler(object msg)
        {
            OnMessage(msg as T);
        }
    }

    //消息特性（用于自动注册服务器协议）
    public class BroadcastAttribute : CGFAttribute
    {
        public int protoId { get; set; }

        public BroadcastAttribute(int protoId)
        {
            this.protoId = protoId;
        }
    }
}
